function encode(e) {
    var t = "";
    try {
        t = JSON.stringify(e)
    } catch (n) {
        return console.error(n + "这不是一个正确的json对象"),
        ""
    }
    return encryptCode(t)
}

let pubPass = "BX1o65CoobwcDP33iQW6ld1OyIPsNzF1"
var pubPassNum = []
setPass(pubPass)

function setPass(e) {
    pubPassNum = stringChangeASCIINumberArrs(e)
}
function encryptCode(e) {
    for (var t = encodeURI(e), n = [], i = 0, r = "", o = random(16, 32), a = randomStr(o), s = stringChangeASCIINumberArrs(a), l = 0, c = 0, u = 0, h = 0; h < t.length; h++)
        i = t.charCodeAt(h),
        l == pubPassNum.length && (l = 0),
        i += pubPassNum[l],
        l++,
        c == s.length && (c = 0),
        i += s[c],
        c++,
        u += i,
        u > 65535 && (u -= 65535),
        r = i.toString(36),
        r = ("00" + r).substr(-2, 2),
        1 == r.length && (r = "0" + r),
        n.push(r);
    var d = "";
    return d = u.toString(36),
    d = ("0000" + r).substr(-4, 4),
    n.unshift(a),
    n.unshift(o.toString(36)),
    n.unshift(d),
    n.join("")
}
function decryptCode(e) {
    var t = ""
      , n = 0
      , i = ""
      , r = []
      , o = []
      , a = 0
      , s = 0;
    t = e.substr(4, 1),
    n = parseInt(t, 36),
    i = e.substr(5, n),
    r = stringChangeASCIINumberArrs(i),
    t = e.substr(5 + n, e.length - 5 - n);
    for (var l = "", c = 0, u = 0, h = 0; h < t.length / 2; h++)
        l = t.substr(u, 2),
        u += 2,
        c = parseInt(l, 36),
        s == r.length && (s = 0),
        c -= r[s],
        s++,
        a == pubPass.length && (a = 0),
        c -= pubPassNum[a],
        a++,
        l = String.fromCharCode(c),
        o.push(l);
    return t = o.join(""),
    t = decodeURI(t),
    t
}
function stringChangeASCIINumberArrs(e) {
    for (var t = [], n = 0; n < e.length; n++)
        t.push(e.charCodeAt(n));
    return t
}

function randomStr(e) {
    for (var t = [], n = 0; n < e; n++)
        t.push(random(0, 35).toString(36));
    return t.join("")
}
function random(e, t) {
    return void 0 === e && (e = 0),
    void 0 === t && (t = 1e4),
    Math.floor(Math.random() * (t - e) + e)
}

function main(){
    var o = {
    "id": "rtpmms523dcrdcgt",
    "projectKey": "honsan_cloud_ccprec",
    "clientKey": "rtpmmq0xug0ugfir",
    "token": null,
    "clientDailyData": {},
    "acts": [
        {
            "id": "rtpmms51uvkhw6s9",
            "fullPath": "/ccprec.com.cn.web/client/info/cqweb_xwgg_tzgg",
            "args": [
                1,
                20,
                null
            ]
        }
    ]
}

    var a = JSON.stringify(o)
    console.log(a)
    s = encode(a)
    return s
}

